/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ControladoresUI;

import Entidades.Jornada;
import Ingresos.IJornada;
import ManagersUI.JornadasModificarManager;
import javafx.event.*;
import javafx.fxml.FXML;
import javafx.scene.control.TextField;
import javax.swing.JOptionPane;

/**
 * FXML Controller class
 *
 * @author JEscalante
 */
public class JornadasModificarController{

    /**
     * Initializes the controller class.
     */
    JornadasModificarManager jornadasModificarManager;
    Jornada registro;
    @FXML private TextField txtNombre;
    public void initialize() {}
  
    public void initManager(final JornadasModificarManager jornadasModificarManager, Jornada registro) {
        this.jornadasModificarManager = jornadasModificarManager;
        this.registro = registro;
        this.txtNombre.setText(registro.getNombre());
    }
    @FXML
    private void cerrarVentana(ActionEvent event){
        jornadasModificarManager.cerrarJornadasModificar();
    }
    @FXML
    private void modificarJornada(ActionEvent event){
        registro.setNombre(this.txtNombre.getText());
        IJornada manejo = new IJornada();
        manejo.modificar(registro);
        JOptionPane.showMessageDialog(null, "Se ha modificado la facultad");
        jornadasModificarManager.cerrarJornadasModificar();
    }
}
